
class Message<T> {
    private T message;
    public T getMessage() {
        return message;
    }
    public void setMessage(T message) {
        this.message = message;
    }
}

class Plate<T> {
    private T message;
    public T getMessage() {
        return message;
    }
    public void setMessage(T message) {
        this.message = message;
    }
}
class Food {

}
class Fruit extends Food {

}
class Apple extends Fruit{

}
class Banana extends Fruit {

}

public class Test2 {

    public static void main(String[] args) {
        Plate<Fruit> plate1=new Plate<>();
        fun1(plate1);

        Plate<Apple> plate2=new Plate<>();
        fun1(plate2);

        Plate<Banana> plate3=new Plate<>();
        fun1(plate3);

        Plate<Food> plate4=new Plate<>();
        fun2(plate4);


    }

    public static void fun2(Plate<? super Fruit> tmp){
        //下界可以接收，但是不能传入
        tmp.setMessage(new Apple());
//        Fruit apple=tmp.getMessage();
    }

    public static void fun1(Plate<? extends Fruit> tmp){
        //上界可以传入，不能接收
        Fruit apple=tmp.getMessage();
//        tmp.setMessage(new Apple());
    }

    public static void main1(String[] args) {
        Message<String> message=new Message<>();
        message.setMessage("比特就业课欢迎您");
        fun(message);

        Message<Integer> message2=new Message<>();
        message2.setMessage(100);
        fun(message2);
    }
    public static void fun(Message<?> temp){
        System.out.println(temp.getMessage());
    }


}
